$(document).ready(function(){  
    //this function will monitor the billing entry    
        $('input[name="accnt_no"]').keyup(function(){
            if($('#butangan')){
                    $('#butangan').fadeOut();
                 }else{
                     $('#butangan').fadeIn();
                 }  
            search_name();     
        }); 
});        
            function search_name(){
                var laog = $('input[name="accnt_no"]').attr('value');
                $.ajax({
                    type:'POST',
                    url:'testing_jquery.php',
                    data:'action=get_name&applicant='+laog,
                    dataType:'json',
                    success:function(data){
                         var to_display='';
                         to_display = '<tbody>';
                         for(idx in data){                            
                                to_display +=  '<tr><td onclick="javascript:place_it('+data[idx].account_no+')"";$(\'#butangan\').fadeOut();">' + data[idx].applicant+ '<td></tr>';                         
                        }
                        to_display += '</tbody></table>';                            
                        $(to_display).appendTo('#butangan');
                    }
                });           
            }
          


         function place_it(account){
             $('input[name="accnt_no"]').attr('value',account);
        }

